#ifndef SERIALBUFFER_H
#define SERIALBUFFER_H

#include <QList>
#include <QByteArray>

//485链路层数据接收缓冲区类( 缓存从串口读取的原始字节流 )
class DalRecvBuffer
{
public:
    static DalRecvBuffer* Instance(){ static DalRecvBuffer _srbuffer; return &_srbuffer; }
    QByteArray& getBuffer(){ return uartReceiveBuffer; }
protected:
    DalRecvBuffer(){}

private:
    DalRecvBuffer(const DalRecvBuffer&);
    DalRecvBuffer& operator = (const DalRecvBuffer&);
    QByteArray uartReceiveBuffer;//485底层数据接收缓冲区
};


// 485应用层接收缓冲区（ 缓存经过数据链路层解析之后的应用层数据帧 ）
class aplRecvBuffer
{
public:
    static aplRecvBuffer* Instance(){ static aplRecvBuffer _aplRBfr; return &_aplRBfr;}
    QList<QByteArray>& getBuffer(){ return applicationLayerReceiveBuffer; }
protected:
    aplRecvBuffer(){}
private:
    aplRecvBuffer(const aplRecvBuffer&);
    aplRecvBuffer& operator = (const aplRecvBuffer&);
    QList<QByteArray> applicationLayerReceiveBuffer;
};


// 485应用层发送缓冲区（ 缓存应用层数据帧，为重传服务 ）
class aplSendBuffer
{
public:
    static aplSendBuffer* Instance(){ static aplSendBuffer _aplSBfr; return &_aplSBfr;}
    QList<QByteArray>& getBuffer(){ return applicationLayerSendBuffer; }
protected:
    aplSendBuffer(){}
private:
    aplSendBuffer(const aplSendBuffer&);
    aplSendBuffer& operator = (const aplSendBuffer&);
    QList<QByteArray> applicationLayerSendBuffer;
};

#endif // SERIALBUFFER_H
